<?php

class Model_WorkinghourCheck {
	public static function hourCheck($file){
		error_reporting(E_ALL ^ E_NOTICE);
		
		
		
		if(!empty($file)){
			$i = 0;
			foreach($file as $filename){
				
				$content = array();
				$content = file_get_contents($filename,true);
			
				$array = explode("\n", $content);
				$AllList = array();
				foreach($array as $v){
			
					$tmpArr = array();
					$detail = preg_split("/[\s,]+/", $v);
					
					if(count($detail) == 10){
						$tmpArr['name'] = trim($detail[0])." ".trim($detail[1]);
						$tmpArr['date'] = $detail[4];
						$tmpArr['hour'] = $detail[5];
						$tmpArr['id'] = $detail[8];
						$AllList[] = $tmpArr;
					}elseif(count($detail) == 11){
						$tmpArr['name'] = trim($detail[0])." ".trim($detail[1]);
						$tmpArr['date'] = $detail[5];
						$tmpArr['hour'] = $detail[6];
						$tmpArr['id'] = $detail[9];
						$AllList[] = $tmpArr;
					}elseif(count($detail) == 12){
						$tmpArr['name'] = trim($detail[0])." ".trim($detail[1]);
						$tmpArr['date'] = $detail[6];
						$tmpArr['hour'] = $detail[7];
						$tmpArr['id'] = $detail[10];
						$AllList[] = $tmpArr;
					}
				
				}
				
				foreach($AllList as $k2 => $v2){
					$timeCheck[$v2['name']][$v2['date']] += $v2['hour'];
				}
				foreach($timeCheck as $k3 => $v3){
					foreach($v3 as $k4 => $v4){
						if($v4 > 12){
							echo "Name = :".$k3." Date:".$k4." HOUR:".$v4."<br/>";
						}
					}
				}

				
			}
		}
	}
}

?>